package com.ff.xyh.common.utils;

import com.ff.xyh.common.entity.post.PostShop;
import com.ff.xyh.common.entity.result.ResultMessage;

/**
 * @Auther FF
 * @Date 2023年 05月 25日
 * @Time 12:14
 */

public class PostUtil {

    private static int getConsumeLevel(long price, long... priceLevels) throws Exception {
        if (priceLevels == null || priceLevels.length==0) throw new Exception("消费等级不可为空");
        for (int i = 0; i < priceLevels.length; i++) {
            if (price <= priceLevels[i]) return i+1;
        }
        throw new Exception("消费等级超出最高限制");
    }
    private static int getConsumeLevel(long price) throws Exception {
        return getConsumeLevel(price, 100, 200, 500, 1000);
    }

}
